package com.ssy.lingxi.marketing.model.constant;

import java.util.Arrays;

/**
 *  拼团状态
 * @author ds
 * @date 2021/6/18
 * @version 2.0.0
 * @see GroupPurchaseStatusEnum
 */
public enum GroupPurchaseStatusEnum {

    ALL(0, "所有状态"),
    DOING(1, "拼团中"),
    SUCCESS(2, "拼团成功"),
    FAIL(3, "拼团失败"),
    ;

    private final Integer code;
    private final String message;

    GroupPurchaseStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        GroupPurchaseStatusEnum statusEnum = Arrays.stream(GroupPurchaseStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return statusEnum == null ? "" : statusEnum.getMessage();
    }

}
